package com.wanghua.mall.order.constant;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author wanghua
 * @create 2021-09-10 20:25
 */
@Component
public class AlipayConstant implements InitializingBean {

    @Value("${alipay.appId}")
    private String appId;
    @Value("${alipay.alipayPublicKey}")
    private String alipayPublicKey;
    @Value("${alipay.merchantPrivateKey}")
    private String merchantPrivateKey;
    @Value("${alipay.notifyUrl}")
    private String notifyUrl;
    @Value("${alipay.encryptKey}")
    private String encryptKey;
    @Value("${alipay.timeoutExpress}")
    private String timeoutExpress;
    @Value("${alipay.webReturnUrl}")
    private String webReturnUrl;

    public static String APP_ID;
    public static String ALIPAY_PUBLIC_KEY;
    public static String MERCHANT_PRIVATE_KEY;
    public static String NOTIFY_URL;
    public static String ENCRYPT_KEY;
    public static String TIMEOUT_EXPRESS;
    public static String WEB_RETURN_URL;

    @Override
    public void afterPropertiesSet() throws Exception {
        APP_ID = appId;
        ALIPAY_PUBLIC_KEY = alipayPublicKey;
        MERCHANT_PRIVATE_KEY = merchantPrivateKey;
        NOTIFY_URL = notifyUrl;
        ENCRYPT_KEY = encryptKey;
        TIMEOUT_EXPRESS = timeoutExpress;
        WEB_RETURN_URL = webReturnUrl;
    }
}
